<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>宠物管理</title>
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/petManage.css">
    <style>
        /* 左侧标签栏选中 */
        .nav-left .nav-left-item.petCategoryManage{
            background: #999;
            color: #fcf9f9;
        }

        .w .pet-add , .w .pet-edit{
            height: 100px;
        }

        .w .pet-screen .screen-btns {
            padding-left: 282px;
        }
    </style>
</head>

<th:block th:include="~{IncludePage}"></th:block>
<div class="pet-screen">
    <div class="screen-btns">
        <button class="btn screen-btn gray" id="btn-new">新增</button>
    </div>

    <div class="pet-search">
        <input type="text" class="search-input" id="search-input" placeholder="请输入宠物名">
        <button class="btn search-btn" id="search-btn">搜索</button>
    </div>
</div>
<div class="search-auto-complete" id="auto-complete">
    <ul class="auto-complete-list" id="auto-complete-list">

    </ul>
</div>

<form action="addCategory" class="pet-add" id="add-form">
    <div class="pet-add-item">
        <label class="add-item-label">种类编号</label>
        <input type="text" class="add-item-input" id="add-categoryid" placeholder="请输入种类编号" name="categoryId">
    </div>
    <div class="pet-add-item">
        <label class="add-item-label">种类名</label>
        <input type="text" class="add-item-input" id="add-name" placeholder="请输入种类名" name="name">
    </div>
    <div class="pet-add-item">
        <label class="add-item-label">描述</label>
        <input type="text" class="add-item-input" id="add-descn" placeholder="请输入图片地址" name="description">
    </div>

    <div class="pet-add-buttons">
        <button class="btn add-pet-btn gray" id="confirm-addCategory-btn">确认添加</button>
        <button class="btn add-pet-btn gray" id="close-form-btn" type="button">关闭</button>
    </div>
</form>

<form action="editCategory" class="pet-edit" id="edit-form">
    <div class="pet-edit-item">
        <label class="edit-item-label">种类编号</label>
        <input type="text" class="edit-item-input" id="edit-categoryid" placeholder="请输入种类编号" name="categoryId">
    </div>
    <div class="pet-edit-item">
        <label class="edit-item-label">种类名</label>
        <input type="text" class="edit-item-input" id="edit-name" placeholder="请输入种类名" name="name">
    </div>
    <div class="pet-edit-item">
        <label class="edit-item-label">描述</label>
        <input type="text" class="edit-item-input" id="edit-descn" placeholder="请输入图片地址" name="description">
    </div>

    <div class="pet-edit-buttons">
        <button class="btn edit-pet-btn gray" id="confirm-edit-btn">确认编辑</button>
        <button class="btn edit-pet-btn gray" id="close-edit-form-btn" type="button">关闭</button>
    </div>
</form>

<div class="pet-table">
    <table class="table" id="pet-table">
        <tr class="table-title">
            <th class="col1">种类编号</th>
            <th class="col2">种类名</th>
            <th class="col3">描述</th>
            <th class="col4">操作</th>
        </tr>
        <tr th:each="category:${categories}"  id="pet-row">
            <td th:text="${category.categoryId}" id="tableItemId"></td>
            <td th:text="${category.name}"></td>
            <td th:text="${category.description}"></td>
            <td class="btns-action">
                <button class="action-btn" id="edit-category-btn">编辑</button>
                <button class="action-btn" id="delete-category-btn">删除</button>
            </td>
        </tr>
    </table>

    <div class="nav-bottom">
        <p class="total">共1条 1页</p>
        <div class="link">上一页</div>
        <p class="current-page">第1页</p>
        <div class="link">下一页</div>
    </div>
</div>

</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="js/petManage.js"></script>
<script src="js/petManage-category.js"></script>
<script src="js/includePage.js"></script>
</html>